#include <system.h>
#include <std.h>
#include <pio.h>

/*pkey--> Function primary key
*/
#define PUTC 		1
#define PUTS        2
#define GETK	 	3
#define HALTa		4


unsigned long _sysfn(unsigned long pkey,unsigned long param2,unsigned long param3,unsigned long param4)
{
	unsigned long ret_val=0;
	switch(pkey)
	{
		case PUTC:ret_val=putchar((int)(param2));
		break;
		case PUTS:ret_val=printf((char *)(param2));
		break;
		case GETK:ret_val=get_key();
		break;
		case HALTa:halt(0);
		break;		
	}
	return ret_val;
}
